unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,PerlRegEx, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  Perl:TPerlRegEx;
begin
  try
    Perl:=TPerlRegEx.Create(nil);

    {Perl.Subject:='[123123]=SUM([T8].[1],[T2].[2])';
    Perl.RegEx:='\[\d+\]=SUM\(\[T\d+\].\[\d+\],\[T\d+\].\[\d+\]\)';
    Perl.RegEx:='\d+';}

    Perl.Subject:='[3]=SUM([T8].[1],[T2].[2])*([2009][1]-[2009][2])';
    Perl.RegEx:='\[\d+\]=SUM\(\[T\d+\].\[\d+\],\[T\d+\].\[\d+\]\)\*\(\[\d+\]\[\d+\]-\[\d+\]\[\d+\]\)';
    {if Perl.Match then
    begin
      ShowMessage('match');
    end else
    begin
      ShowMessage('not match');
    end;   }
    while Perl.MatchAgain do
    begin
      ShowMessage(Perl.MatchedExpression);
    end;
  finally
    FreeAndNil(Perl);
  end;

end;

end.
